internal/external link colors and open https in external browser

James Peret 8 years ago
parent
commit
a6faaac3c1
3 changed files with 27 additions and 10 deletions
  1. 7 1
      app/scripts/controllers/note-view-ctrl.js
  2. 12 9
      codex/index.md
  3. 8 0
      css/codex.css

+ 7 - 1
app/scripts/controllers/note-view-ctrl.js

@@ -48,6 +48,12 @@ angular.module('codexApp.noteView', [])
48 48
         var a = document.getElementsByTagName('a'), ajax;
49 49
         for (var i=0; i<a.length; ++i) {
50 50
            a[i].addEventListener('click', handleAnchor, false);
51
+           console.log(a[i].toString());
52
+           var parts = $scope.getUrlParts(a[i].toString())
53
+           console.log(parts.protocol)
54
+           if(parts.protocol == "file:"){
55
+             a[i].className += "internal-link";
56
+           }
51 57
         }
52 58
 
53 59
         // Syntax Highlight
@@ -58,7 +64,7 @@ angular.module('codexApp.noteView', [])
58 64
         function handleAnchor(e){
59 65
             e.preventDefault();
60 66
             var r = new RegExp('^(?:[a-z]+:)?//', 'i');
61
-            if(e.srcElement.protocol == "http:"){
67
+            if(e.srcElement.protocol == "http:" || e.srcElement.protocol == "https:"){
62 68
               console.log("-> Prevented link from opening: " + e.srcElement.outerHTML.match(/href="([^"]*)/)[1]);
63 69
               var open = require("open");
64 70
               open(e.srcElement.outerHTML.match(/href="([^"]*)/)[1]);

+ 12 - 9
codex/index.md

@@ -1,22 +1,25 @@
1 1
 # Index
2 2
 
3
+## Projects
4
+
5
+- [codex](dev/codex-app/index.md) ⭐
6
+- [artpimp](inbox/artpimp-notes.md) ⭐
7
+- [Beta Bot](dev/betabot/betabot.md) ⭐
8
+- [Star Trek Ebook](inbox/star-trek-ebook.md)
9
+- [Radio Transmitter](inbox/radio-transmitter.md)
10
+- [kalinkaprates.com](inbox/kalinkaprates-website.md)
11
+
3 12
 ## Research
4 13
 
14
+* [Programming](Research/programming/index.md)
5 15
 * [Chem Lights](Research/ChemLights/index.md)
6 16
 * [The Press Kit is Dead - Use this instead](Research/startups/The Press Kit is Dead - Use this instead.md)
7 17
 * [Markdown Syntax](inbox/test_note.md)
8 18
 * [Test Note 0001](Test-Stack/Notebook 2/Test-0001/index.md)
9
-* [Raspberry Pi Getting Started Guide](Research/Raspberry-Pi/index.md)
10
-
11
-## Codex Dev
12
-
13
-* [Todo's](dev/codex-app/todos.md)
14
-* [Notes](dev/codex-app/notes.md) 
15
-* [Highlight JS](dev/codex-app/highlightjs.md)
16
-* [Encryption](dev/codex-app/Encryption.md)
17 19
 
18
-## Trip
20
+## Notes
19 21
 
22
+* [German VISA](inbox/german_visa.md)
20 23
 * [Planning](Notes/Trip 2016/planning.md) ⭐
21 24
 * [Job Search](Notes/Job Search/index.md)
22 25
 * [J1X Server](inbox/j1x-server.md)

+ 8 - 0
css/codex.css

@@ -78,6 +78,14 @@ code {
78 78
   border-radius: 6px;
79 79
 }
80 80
 
81
+.internal-link {
82
+  color: #2196F3;
83
+}
84
+
85
+a {
86
+  color: #3F51B5;
87
+}
88
+
81 89
 
82 90
 /* File View */
83 91